﻿using GraphProcessor;
using IQIGame.Onigao.Logic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [System.Serializable, NodeMenuItem(LevelEditorConst.Execution + "/" + LevelEditorConst.CameraMotion, typeof(LevelServiceGraph))]
    public class LevelServiceExecutionNode_CameraMotion : LevelServiceExecutionNode
    {
        protected override ServiceExecutionType mServiceType => ServiceExecutionType.CameraMotion;

        public override string name => LevelEditorConst.CameraMotion;
        [LevelServiceEditorCustomProperty(ServiceExecutionType.CameraMotion, "LevelScreenSwitch表ID")]
        public int screenSwitchCid;

        protected override LevelServiceCustomConfig CreateConfig()
        {
            var rConfig = new LevelServiceExecutionCustom_CameraMotion()
            {
                screenSwitchCid = this.screenSwitchCid
            };
            return rConfig;
        }
        
        protected override void OnSync(EditorLevelServiceExecutionConfig newConfig, LevelServiceExecutionNode tempNode)
        {
            if (tempNode is LevelServiceExecutionNode_CameraMotion rNode)
            {
                this.screenSwitchCid = rNode.screenSwitchCid;
            }
        }
    }
}